/**
 * 
 * @param date 时间戳
 * @param isShowDes 是否显示详细时间
 * @returns 封装好的时间
 */
export function formDates(date: string, isShowDes: boolean): string {
    let nowDate = new Date(+date);
    let year = nowDate.getFullYear();
    let month = nowDate.getMonth() + 1;
    let day = nowDate.getDate();
    let hour = nowDate.getHours();
    let minute = nowDate.getMinutes();
    let second = nowDate.getSeconds();
    let week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
    if (month >= 0 && month < 10) {
        month = `0 ${month}` as any;
    }
    if (day >= 0 && day < 10) {
        day = `0${day}` as any;
    }
    if (hour >= 0 && hour < 10) {
        hour = '0' + hour as any;
    }
    if (minute >= 0 && minute < 10) {
        minute = '0' + minute as any;
    }
    if (second >= 0 && second < 10) {
        second = '0' + second as any;
    }
    if (isShowDes) {
        return `${year}-${month}-${day} ${hour}:${minute}:${second} ${week[nowDate.getDay()]}`
    }
    return `${year}-${month}-${day}`;
}